package com.actimize.service.impl;

import java.util.List;

import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.actimize.dao.AccountDao;
import com.actimize.dao.TranDao;
import com.actimize.dao.hibernate.TranDaoHibernate;
import com.actimize.model.Transaction;
import com.actimize.service.TransactionManager;
import com.actimize.service.TransactionService;

@Service("transactionManagerTmp")
@WebService(serviceName = "TransactionService", endpointInterface = "com.actimize.service.TransactionService")
public class TransactionManagerImpl extends
		GenericManagerImpl<Transaction, Long> implements TransactionManager,
		TransactionService {

	private TranDao tranDao;
	//@Autowired
		public TransactionManagerImpl(TranDao tranDao){
			super(tranDao);
			this.tranDao = tranDao;
		}
		
		public TransactionManagerImpl(){
			this.tranDao = new TranDaoHibernate();
		}
		
		@Autowired
	    public void setTransactionDao(TranDao tranDao) {
	        this.dao = tranDao;
	        this.tranDao = tranDao;
	    }	
		@Autowired
	    public void setTransDao(TranDao tranDao) {
	        this.dao = tranDao;
	        this.tranDao = tranDao;
	    }	
	@Override
	public Transaction save(Transaction object) {
		return tranDao.save(object);
	}

	@Override
	public void remove(Transaction object) {

		tranDao.remove(object);
	}

	@Override
	public void setTranDao(TranDao tranDao) {

		this.tranDao = tranDao;
		this.dao = tranDao;
	
	}

	@Override
	public Transaction getTransaction(Long tranId) {
		
		return tranDao.get(tranId);
		
	}

	@Override
	public List<Transaction> getTrans() {
		
		return tranDao.getTrans();
	}

	@Override
	public Transaction saveTran(Transaction tran) {
		return tranDao.saveTran(tran);
	}
}